<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
		<script src="./scripts/vue.js"></script>
		<script src="./scripts/vue-router_3.0.2.js"></script>
	</head>
	<body>
		<div id="app">
			<router-link to="/login">登录</router-link>
			<router-link to="/register">注册</router-link>

			<router-view></router-view>
		</div>

		<script>
			var Login = {
				template: `<h2>登录</h2>`
			}
			var Register = {
				template: `<h2>注册</h2>`
			}
			var router = new VueRouter({
				routes: [
					// 重定向
					{ path: '/', redirect: '/login' },
					{ path: '/login', component: Login },
					{ path: '/register', component: Register }
				]
			})
			var vm = new Vue({
				el: '#app',
				data: {},
				router
			})
		</script>
	</body>
</html>
